const Basics = require('../model/basics.model')
const {userRegisterError} = require("../constant/err.type");
class BasicsService {
   async editBasics (param, type) {
       try {
          if (type && type === 'create') {
              const res = await Basics.create(param)
              return res ? res.dataValues : null
          } else {
              const res = await Basics.update({...param}, {where: {userId: param.userId}})
              return res ? res : null
          }
       } catch (err) {
           console.log('err', err)
           return null
       }
    }
    async hqzl (userId) {
       try {
           const res = await Basics.findOne({where: { userId}})
           console.log('结果', res)
           return [res.dataValues]
       } catch (err) {
           console.log('err', err)
           return null
       }
    }
}
module.exports = new BasicsService()
